package com.yykj.hospital.server.converter;

import com.yykj.hospital.client.dto.DoctorArticleDTO;
import com.yykj.hospital.server.model.entity.DoctorArticle;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

public class DoctorArticleDTOConverter {
    public static DoctorArticleDTO convert(DoctorArticle item){
        DoctorArticleDTO dto = new DoctorArticleDTO();
        BeanUtils.copyProperties(item,dto);
        return dto;
    }

    public static List<DoctorArticleDTO> convert(List<DoctorArticle> list){
        return list.stream().map(DoctorArticleDTOConverter::convert).collect(Collectors.toList());
    }
}
